package com.feri.redromance01.controller;

import com.feri.redromance01.entity.User;
import com.feri.redromance01.service.intf.UserService;
import com.feri.redromance01.vo.PageBean;
import com.feri.redromance01.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/user/")

public class UserController {
    @Autowired
    private UserService service;

    /*
    新增
     */
    @PostMapping("save.do")
    public R save(User user){
        return service.save(user);

    }

    /* 修改 */
    @PostMapping("update.do")
    public R update(User user){
        return service.update(user);
    }

    /* 删除 */
    @GetMapping("del.do")
    public R del(int u_id){
        return service.delete(u_id);
    }

    /* 查询 */
    @GetMapping("page.do")
    public PageBean page(String user_act,int page,int limit){
        return service.selectPage(user_act,page,limit);
    }
}
